﻿using IService.Admin;

namespace Service.Admin
{
    public class RecycleSendHandleService : BaseService<TRecycleSendHandle>, IRecycleSendHandleService
    {
        public RecycleSendHandleService(IUnitOfWorkService unitOfWorkService) : base(unitOfWorkService)
        {
        }

        /// <summary>
        /// 添加或修改
        /// </summary>
        /// <param name="par"></param>
        /// <returns></returns>
        public async Task<RM_ApiResult> AddOrUpdate(TRecycleSendHandle par)
        {
            par.HandleTime = DateTime.Now;
            par.AdminId = _CurrentAdmin.Id;

            var result = await AddOrUpdate(par, true);

            if (result > 0)
            {
                await Status<TRecycleReq>(par.ReqId, par.Status);
                return _ResultHelper.BuildActionSuccess();
            }
            else
            {
                return _ResultHelper.BuildActionError();
            }
        }
    }
}